Intellisense not working with some 'std' members unless I specify 'using namespace std' 路 Issue #911 路 microsoft/vscode | 您所在的位置:网站首页 › std::string has no member › Intellisense not working with some 'std' members unless I specify 'using namespace std' 路 Issue #911 路 microsoft/vscode |
See reply below for code to easily repro Intellisense seems to ignore certain std members unless I specify using namespace std Example: #include struct Font { /* ...other members... */ std::unordered_map< int, Glyph > glyphList; };This does not work, and VSCode will claim in my .cpp file: class "Render::Font" has no member "glyphList" Intellisense will work for every other member in the Font struct except glyphList. If I change the code to the following, it works perfectly fine: #include using namespace std; struct Font { /* ...other members... */ unordered_map< int, Glyph > glyphList; };By including using namespace std and removing std:: from the front of unordered_map, intellisense will correctly recognize glyphList as a member of Font. Oddly enough, other std members such as std::string work fine and are properly recognized by intellisense without having to use the above workaround: struct Font { std::string filename; // works fine std::unordered_map< int, Glyph > glyphList; // not recognized as a member of Font by intellisense };Additionally, this will also happen if I'm including a container's header within another included file, even with the above workaround: #include "Base.h" // contains #include using namespace std; struct Parts { vector< int > slices; // not recognized };This is fixed by adding #include to the file, however not doing so still produces perfectly valid code with g++, with not even a warning. It appears as if intellisense is not recognizing includes within other included files. It however does not complain that vector is undefined, so clearly it recognizes it to some extent. This is with "C_Cpp.intelliSenseEngine": "Default" turned on. I'm running VSCode 1.14.2, cpptools 0.12.1, and Arch Linux. |
CopyRight 2018-2019 实验室设备网 版权所有 |